/* eslint-disable no-param-reassign */
/* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */
export const defaultReqParams = {
  ignoreErrorToast: false,
  showLoading: false,
  deleteEmptyParam: true,
};

/**
 * 需要重新登录的code
 */
export const authorityFailureCodes = ['120001', '120002', '120003', '120010', '10020302', '10020301'];

// 响应状态
export const responeStatus = {
  SUCCESS: 'SUCCESS',
  ERROR: 'ERROR',
};

// 删除空值
export const deleteEmptyParams = (data) => {
  const params = data || {};
  Object.keys(params).forEach((item) => {
    if (params[item] === null || params[item] === undefined || params[item] === '') {
      delete params[item];
    }
  });
  return params;
};
